package com.fpost.manager;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.fpost.dao.impl.ArticleCommentDAO;
import com.fpost.domain.ArticleComment;

public class ArticleCommentManager {
	
	public Long save(ArticleComment articleComment) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		return dao.save(articleComment);
	}

	public void delete(long id) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		dao.delete(id);

	}

	public void delete(ArticleComment articleComment) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		dao.delete(articleComment);
	}

	public ArticleComment get(long id) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		return dao.get(id);
	}

	public void saveOrUpdate(ArticleComment articleComment) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		dao.saveOrUpdate(articleComment);
	}
	
	@SuppressWarnings("unchecked")
	public List<ArticleComment> getAll() throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		return dao.getAll();
	}
	
	@SuppressWarnings("unchecked")
	public List<ArticleComment> getCommentsByArticleId(long articleId) throws HibernateException {
		ArticleCommentDAO dao = new ArticleCommentDAO();
		return dao.getCommentsByArticleId(articleId);	
	}
}
